package com.hknc.btscale.utils.network;

import com.hknc.btscale.bean.BackToServer;
import com.hknc.btscale.bean.GoodsBackToServer;
import com.hknc.btscale.bean.LoginPost;
import com.hknc.btscale.bean.LoginResponse;
import com.hknc.btscale.bean.NormalResponse;
import com.hknc.btscale.bean.OffLineData;
import com.hknc.btscale.bean.OffLineList;
import com.hknc.btscale.bean.OrderResult;
import com.hknc.btscale.bean.PlayRulesBackToServer;
import com.hknc.btscale.bean.SaveOrderBean;
import com.hknc.btscale.bean.TestBean1;
import com.hknc.btscale.bean.UploadStatus;
import com.hknc.btscale.bean.VersionApkBean;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface ApiServer {

    /**
     * 登录
     *
     * @return LoginResponse
     *
     * Ycl
     */
    @Headers("Content-Type:application/json; charset=utf-8")
    @POST("/bluetoothScales/merchantMsg")
    Observable<LoginResponse> login(@Body LoginPost loginPost);

    /**
     * 称响应接口
     *
     * @param backToServer
     * @return
     */
    @Headers("Content-Type:application/json; charset=utf-8")
    @POST("/bluetoothScales/scaleResponse")
    Observable<NormalResponse> backToServer(
            @Body BackToServer backToServer
    );

    /**
     * 调用推送商品信息接口
     *
     * @param goodsBackToServer
     * @return
     */
    @Headers("Content-Type:application/json; charset=utf-8")
    @POST("/bluetoothScales/batchDelivery")
    Observable<NormalResponse> goodsBackToServer(
            @Body GoodsBackToServer goodsBackToServer
    );

    /**
     * 调用播放规则的推送接口
     *
     * @param playRulesBackToServer
     * @return
     */
//    @Headers("Content-Type:application/json; charset=utf-8")
//    @POST("/bluetoothScales/playRulesYcl")
//    Observable<NormalResponse> playRulesBackToServer(
//            @Body PlayRulesBackToServer playRulesBackToServer
//    );

    /**
     * 调用保存订单接口
     *
     * @param saveOrderBean
     * @return
     */
    @Headers("Content-Type:application/json; charset=utf-8")
    @POST("/bluetoothScales/addOrder")
    Observable<OrderResult> addOrder(
            @Body SaveOrderBean saveOrderBean
    );

    /**
     * 离线数据上传
     *
     * @param offLineList
     * @return
     */
    @Headers("Content-Type:application/json; charset=utf-8")
    @POST("/bluetoothScales/addOffLineOrder")
    Observable<NormalResponse> addOffLineOrder(
            @Body List<OffLineData> offLineList
    );

    /**
     * 版本号获取校验
     *
     * @param marketId
     * @return
     */
    @GET("/bluetoothScales/apkVersion")
    @Headers({"Content-Type:application/x-www-form-urlencoded; charset=utf-8"})
    Observable<VersionApkBean> apkVersion(
            @Query("marketId") String marketId
    );

    @POST("/bluetoothScales/parametersAndIsLock")
    @Headers("Content-Type:application/json; charset=utf-8")
    Observable<NormalResponse> parametersAndIsLock(
            @Body UploadStatus uploadStatus
    );
}

